<?php
class Silk_Pms_Block_Adminhtml_Exchange_New extends Mage_Adminhtml_Block_Widget{
	public function __construct()
	{
		parent::__construct();
		$this->setTemplate('pms/exchange/new.phtml');
	}
	public function getExchange(){
		if(Mage::registry("exchange")){
			return Mage::registry("exchange");
		}
	}
	public function getWebsiteqty($productId,$websiteId){
		$collection = Mage::getModel("catalog/product")->getCollection()->addAttributeToSelect('*');
		if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
		    $collection->joinField('qty',
		        'cataloginventory/stock_item',
		        'qty',
		        'product_id=entity_id',
		        '{{table}}.stock_id=1 AND {{table}}.website_id = ' . $websiteId,
		        'left');
		}
		$collection->addAttributeToFilter('entity_id',$productId);
		$product = $collection->getFirstItem();
		$qty = $product->getQty();
		return $qty;
	}
}